var app = getApp();
var wxRequest = require('./wxRequest.js');

const host = "https://www.xxxxxxx.com";
const formatTime = date => {
  const year = date.getFullYear()
  const month = date.getMonth() + 1
  const day = date.getDate()
  const hour = date.getHours()
  const minute = date.getMinutes()
  const second = date.getSeconds()

  return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}

const formatNumber = n => {
  n = n.toString()
  return n[1] ? n : '0' + n
}
//功能配置
const configSet = function(data){
  var url = host + "/xx";
  var res = wxRequest.postRequest(url,data);
  return res;
}
//搜索
const searchList = function(data){
  var url = host + "/xx";
  var res = wxRequest.postRequest(url,data);
  return res;
}
//请求标签
const groupList = function(data){
  var url = host + "/xx";
  var res = wxRequest.postRequest(url,data);
  return res;
}

//请求标签中的标签
const getGroups = function(data){
  var url = host + "/xx";
  var res = wxRequest.postRequest(url,data);
  return res;
}
//请求表情包
const getPackages = function(data){
  var url = host + "/xx";
  var res = wxRequest.postRequest(url,data);
  return res;
}
//请求表情包
const getSinglePage = function(data){
  var url = host + "/xx";
  var res = wxRequest.postRequest(url,data);
  return res;
}
//请求表情列表
const getList = function(data){
  var url = host + "/xx";
  var res = wxRequest.postRequest(url,data);
  return res;
}
//请求单个表情
const getDetail = function(data){
  var url = host + "/xx";
  var res = wxRequest.postRequest(url,data);
  return res;
}
module.exports = {
  formatTime: formatTime,
  groupList:groupList,
  getGroups:getGroups,
  getPackages:getPackages,
  getSinglePage:getSinglePage,
  getList : getList,
  getDetail:getDetail,
  searchList:searchList,
  configSet:configSet
}
